﻿<shared:PageBase x:Class="Bymed.SpineScan.WPF.PatientBasicInfoPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:shared="clr-namespace:Bymed.SpineScan.WPF.Shared"
      xmlns:validationRule="clr-namespace:Bymed.SpineScan.WPF.ValidationRules"
      mc:Ignorable="d" 
      x:Name="CurrentPage"
      d:DesignHeight="600" d:DesignWidth="1280"
	  Title="PatientBasicInfoPage" Style="{StaticResource DefaultPageStyle}"
      DataContext="{Binding PatientBasicInfo, Source={StaticResource Locator}}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Skins/Storyboard/PageStoryborad.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid Width="1200">
        <Grid.RowDefinitions>
            <!-- Main Content -->
            <RowDefinition Height="Auto" />
            <!-- Navigation Buttons -->
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid Width="1062" Height="540">
            <Grid.Background>
                <ImageBrush ImageSource="/Skins/Resource/Image/GrayRightAboveTabBackground.png" />
            </Grid.Background>
            <Grid>
                <Grid.RowDefinitions>
                    <!-- Page Title -->
                    <RowDefinition Height="100" />
                    <!-- Patient Info -->
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <TextBlock Text="被测者信息" Margin="0,10,15,0" HorizontalAlignment="Right" Style="{StaticResource PageTitleTextBlock}" />
                <StackPanel Grid.Row="1" HorizontalAlignment="Center" Orientation="Horizontal">
                    <Image VerticalAlignment="Top" Margin="0,0,30,0" Source="/Skins/Resource/Image/UserPicture.png" Width="175" />
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <!-- Info Title -->
                            <ColumnDefinition Width="60" />
                            <!-- Info Input -->
                            <ColumnDefinition Width="Auto" />
                            <!-- Separator -->
                            <ColumnDefinition Width="60" />
                            <!-- Info Title -->
                            <ColumnDefinition Width="60" />
                            <!-- Info Input -->
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <!-- Number & Name -->
                            <RowDefinition Height="Auto" />
                            <!-- Separator -->
                            <RowDefinition Height="30" />
                            <!-- Gender & Birthday -->
                            <RowDefinition Height="Auto" />
                            <!-- Separator -->
                            <RowDefinition Height="30" />
                            <!-- Height & Weight -->
                            <RowDefinition Height="Auto" />
                            <!-- Separator -->
                            <RowDefinition Height="30" />
                            <!-- Remark -->
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TextBlock Text="编号" VerticalAlignment="Center" Style="{StaticResource InfoTextBlock}" />
                        <TextBox Grid.Column="1" HorizontalAlignment="Left" Width="240" Height="50" IsEnabled="{Binding IsNewData}" Style="{StaticResource InfoTextBox}">
                            <TextBox.Text>
                                <Binding Path="Number" UpdateSourceTrigger="PropertyChanged">
                                    <Binding.ValidationRules>
                                        <validationRule:PatientNumberValidationRule />
                                    </Binding.ValidationRules>
                                </Binding>
                            </TextBox.Text>
                        </TextBox>
                        <TextBlock Grid.Column="3" Text="姓名" Style="{StaticResource InfoTextBlock}" VerticalAlignment="Center" />
                        <TextBox Grid.Column="4" VerticalContentAlignment="Center" Width="240" Height="50" Style="{StaticResource InfoTextBox}" HorizontalAlignment="Left">
                            <TextBox.Text>
                                <Binding Path="Name" UpdateSourceTrigger="PropertyChanged">
                                    <Binding.ValidationRules>
                                        <validationRule:PatientNameValidationRule />
                                    </Binding.ValidationRules>
                                </Binding>
                            </TextBox.Text>
                        </TextBox>
                        <TextBlock Grid.Row="2" Text="性别" Style="{StaticResource InfoTextBlock}" VerticalAlignment="Center" />
                        <StackPanel Grid.Column="1" Grid.Row="2" Width="190" Height="40"
                                Orientation="Horizontal" HorizontalAlignment="Left">
                            <RadioButton Content="男" IsChecked="{Binding IsMale}" Margin="0,5,0,0" FontSize="24" Padding="10,0,10,0"
                                     HorizontalAlignment="Left" VerticalContentAlignment="Center" Style="{StaticResource NewRadioButtonStyle}" />
                            <RadioButton Content="女" IsChecked="{Binding IsFemale}" FontSize="24" Margin="30,5,10,0" Padding="10,0,10,0"
                                     HorizontalAlignment="Left" VerticalContentAlignment="Center" Style="{StaticResource NewRadioButtonStyle}" />
                        </StackPanel>
                        <TextBlock Grid.Column="3" Grid.Row="2" Text="生日" Style="{StaticResource InfoTextBlock}" VerticalAlignment="Center" />
                        <StackPanel Grid.Column="4" Grid.Row="2" Width="200" Height="40"
                                Margin="0" Orientation="Horizontal" HorizontalAlignment="Left">
                            <Border BorderThickness="1" BorderBrush="DarkGray" Background="#fafafa" CornerRadius="10">
                                <Border.Effect>
                                    <DropShadowEffect ShadowDepth="1" Opacity="0.6" />
                                </Border.Effect>
                                <DatePicker SelectedDate="{Binding Birthday, UpdateSourceTrigger=PropertyChanged}" DisplayDate="1/1/1970" FontSize="14" BorderThickness="0" Margin="35,10,40,0" Width="122"
                                    RenderTransformOrigin="0.5,0.5" >
                                    <DatePicker.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="1.5" ScaleY="1.5"/>
                                            <SkewTransform/>
                                            <RotateTransform/>
                                            <TranslateTransform/>
                                        </TransformGroup>
                                    </DatePicker.RenderTransform>
                                </DatePicker>
                            </Border>                                
                        </StackPanel>
                        <TextBlock Grid.Row="4" Text="身高" Style="{StaticResource OptionalFieldTextBlock}" VerticalAlignment="Center" />
                        <StackPanel Grid.Row="4" Grid.Column="1" Orientation="Horizontal">
                            <TextBox VerticalContentAlignment="Center" Width="180" Height="50" Style="{StaticResource InfoTextBox}" HorizontalAlignment="Left">
                                <TextBox.Text>
                                    <Binding Path="Height" UpdateSourceTrigger="PropertyChanged">
                                        <Binding.ValidationRules>
                                            <validationRule:PatientHeightValidationRule />
                                        </Binding.ValidationRules>
                                    </Binding>
                                </TextBox.Text>
                            </TextBox>
                            <TextBlock Margin="10,0,0,0" Text="厘米" Style="{StaticResource OptionalFieldTextBlock}" VerticalAlignment="Center" />
                        </StackPanel>
                        <TextBlock Grid.Row="4" Grid.Column="3" Text="体重" Style="{StaticResource OptionalFieldTextBlock}" VerticalAlignment="Center" />
                        <StackPanel Grid.Row="4" Grid.Column="4" Orientation="Horizontal">
                            <TextBox VerticalContentAlignment="Center" Width="180" Height="50" Style="{StaticResource InfoTextBox}">
                                <TextBox.Text>
                                    <Binding Path="Weight" UpdateSourceTrigger="PropertyChanged">
                                        <Binding.ValidationRules>
                                            <validationRule:PatientWeightValidationRule />
                                        </Binding.ValidationRules>
                                    </Binding>
                                </TextBox.Text>
                            </TextBox>
                            <TextBlock Margin="10,0,0,0" Text="公斤" Style="{StaticResource OptionalFieldTextBlock}" VerticalAlignment="Center" />
                        </StackPanel>
                        <TextBlock Grid.Row="6" Text="备注" Style="{StaticResource OptionalFieldTextBlock}" />
                        <TextBox Grid.Column="1" Grid.ColumnSpan="4" Grid.Row="6" VerticalContentAlignment="Top" Width="600" Height="140" AcceptsReturn="True" 
                             VerticalScrollBarVisibility="Auto" Style="{StaticResource InfoTextBox}" HorizontalAlignment="Left">
                            <TextBox.Text>
                                <Binding Path="Remark" UpdateSourceTrigger="PropertyChanged">
                                    <Binding.ValidationRules>
                                        <validationRule:PatientRemarkValidationRule />
                                    </Binding.ValidationRules>
                                </Binding>
                            </TextBox.Text>
                        </TextBox>
                    </Grid>
                </StackPanel>
            </Grid>
        </Grid>
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Content="查询" Margin="0,0,120,0" Tag="/Skins/Resource/Image/Search.png" Style="{StaticResource NavigationButton}" Click="ButtonSearch_Click" />
            <Button Content="重新填写" Margin="0,0,120,0" Tag="/Skins/Resource/Image/Refresh.png" Style="{StaticResource NavigationButton}" Command="{Binding RefreshCommand}" />
            <Button Content="下一步" Tag="/Skins/Resource/Image/Next.png" Style="{StaticResource NavigationButton}" Command="{Binding NextCommand}" />
        </StackPanel>
    </Grid>
</shared:PageBase>